package com.zhentao.controller;

import com.zhentao.common.constants.ArticleConstants;
import com.zhentao.model.article.dto.ArticleHomeDto;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;

    @RequestMapping("/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto) {
//        return articleService.load(0,dto);
        return articleService.load2(dto, ArticleConstants.LOADTYPE_LOAD_MORE, true);
    }

    @RequestMapping("/loadmore")
    public ResponseResult loadmore(@RequestBody ArticleHomeDto dto) {
        return articleService.load(1, dto);
    }

    @RequestMapping("/loadnew")
    public ResponseResult loadnew(@RequestBody ArticleHomeDto dto) {
        return articleService.load(2, dto);
    }
}
